package ch13.d1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

public class Test1 {
    public static void main(String[] args) throws InterruptedException {
//        List<Integer> list=List.of(1,2,3,4,5,6,7,8,9,10);
//        Stream<Integer> s=list.stream();
//        s.forEach(e->System.out.println(e));
//        s.forEach(System.out::println);// 方法引用

//        Stream.generate( ()->Math.random();
        List<Integer> list=List.of(1,2,3,4,5,6,7,8,9,10);
//        list.stream().max( (x,y)->x-y);
        Optional<Integer> max=list.stream().max( (x, y)->x.compareTo(y));


        System.out.println(max.get());



    }
}
